#pragma once

#include "comm/my_syscall.h"
#include "comm/my_thread_base.h"
#include "my_event_loop.h"

// handlers adpater
// this file should not be included in ".h"


static inline void
my_file_close_handle(void *data)
{
    FILE *file = (FILE *)data;
    fclose(file);
}


static inline void
my_fd_close_handle(void *data)
{
    my_syscall_close((int)(intptr_t)data);
}


static inline void
my_thread_free_handle(void *data)
{
    my_thread_free(data);
}


static inline void
my_event_loop_remove_conn_handle(void *data)
{
    my_conn_t *conn = (my_conn_t *)data;
    my_event_loop_remove_conn(conn);
}


static inline void
my_conn_close_handle(void *data)
{
    my_conn_t *conn = (my_conn_t *)data;
    my_conn_close(conn);
}